#region Imported Namespaces
using System;
using System.Web;
#endregion

namespace PHSRAG.Insight21.FormsManagement.Serialization
{
	#region Class FormItemOption
	/// <summary>
	/// FormItemOption is a serializable version of the ItemOption class.
	/// </summary>
	public class FormItemOption : System.ICloneable
	{
		#region Private Instance Variables
		private string optionText = string.Empty;
		private string htmlStrippedOptionText = string.Empty;
		private string optionValue = string.Empty;
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the text of the item option
		/// </summary>
		public string OptionText
		{
			get { return optionText; }
			set { optionText = value; }
		}
		/// <summary>
		/// Gets or sets the option text without any html tags
		/// </summary>
		public string HtmlStrippedOptionText
		{
			get { return htmlStrippedOptionText; }
			set { htmlStrippedOptionText = value; }
		}
		/// <summary>
		/// Gets or sets the value of the item option
		/// </summary>
		public string OptionValue
		{
			get { return optionValue; }
			set { optionValue = value; }
		}
		#endregion

		#region Constructors
		/// <summary>
		/// Default Constructor required while serializing the object
		/// </summary>
		public FormItemOption()
		{
		}
		

		/// <summary>
		/// Constructs a FormItemOption out of the ItemOption object passed in as a paramter
		/// </summary>
		/// <param name="o">ItemOption object from which the FormItemOption objects needs to be constructed</param>
		public FormItemOption(ItemOption o)
		{
			string optionProperty = o.OptionText;
			optionText = (optionProperty == null) ? string.Empty : HttpUtility.HtmlDecode(optionProperty);
			htmlStrippedOptionText = HttpUtility.HtmlDecode(o.HtmlStrippedOptionText);
			optionProperty = o.OptionValue;
			optionValue = (optionProperty == null) ? string.Empty : optionProperty;
		}
		
		#endregion
		
		#region ICloneable Members
		/// <summary>
		/// Explicit interface method implementation - available for 
		/// clients of ICloneable, but invisible to other
		/// clients of FormItemOption class
		/// </summary>
		/// <returns>FormItemOption clone as a generic object</returns>
		object ICloneable.Clone()
		{
			return Clone();
		}

		
		/// <summary>
		/// Deep copies the FormItemOption object
		/// </summary>
		/// <returns>The new FormItemOption object after cloning</returns>
		public FormItemOption Clone()
		{
			return (FormItemOption)MemberwiseClone();
		}
		#endregion
	}
	#endregion
}
